package com.zhouwr.common.metadata;

import com.alibaba.fastjson.JSON;
import com.zhouwr.common.enums.ModelDataType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @program: forallcn-iotps
 * @description:
 * @author: zhouwr
 * @create: 2020-11-26 22:42
 * @version：1.0
 **/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ByteData extends Metadata<Byte> {
    private Byte defaultValue = 0x0;
    private ModelDataType type =  ModelDataType.BYTE;


    @Override
    public Byte getDefaultValue() {
        return this.defaultValue;
    }

    public static Metadata<?> form(String metadata) {
        return JSON.toJavaObject(JSON.parseObject(metadata), ByteData.class);
    }

}
